/**
*	弹出顶层窗口
*	data 为JSON串 其属性有：
*		src			弹出窗口链接
*		title		标题
*		width		弹出窗口的宽度
*		height		弹出窗口的高度
*		position	弹出位置
*		savefunc	点击保存时调用的方法，如果方法返回“success”则关闭
*		closefunc	点击关闭时调用的方法，如果方法返回“success”则关闭
*	windowWork 调用该方法所在的window
*	params 参数数组，传入回调函数中
*/
function calltopdailog(data,windowWork,params){
	var jsonObject = eval("("+data+")");
	var src = jsonObject.src;
	var title = jsonObject.title;
	var position = "center";
	if(jsonObject.position){
		position = jsonObject.position;
	}
	var width=800;
	if(jsonObject.width){
		width = jsonObject.width;
	}
	var height=600;
	if(jsonObject.height){
		height = jsonObject.height;
	}
	var closefunc=jsonObject.closefunc;
	var savefunc=jsonObject.savefunc;
	$('<iframe scrolling="auto" frameborder="0" />').dialog({
               title: title,
               autoOpen: true,
               width: width,
               height: height,
               modal: true,
            position:position,
            open:function(){
                   $(this).attr("src",encodeURI(src));
            },
            buttons: {
				"保存": function() {
					if(savefunc){
						if(windowWork.eval(savefunc)(this,params)=="success"){
							$( this ).dialog( "close" );
						}
					}else{
						$( this ).dialog( "close" );
					}
				},
				"关闭": function() {
					if(closefunc){
						if(windowWork.eval(closefunc)(this,params)=="success"){
							$( this ).dialog( "close" );
						}
					}else{
						$( this ).dialog( "close" );
					}
				}
			}  
           }).width(width-30).height(height-30);
}
/**
*	弹出顶层窗口
*	data 为JSON串 其属性有：
*		src			弹出窗口链接
*		title		标题
*		width		弹出窗口的宽度
*		height		弹出窗口的高度
*		position	弹出位置
*		savefunc	点击保存时调用的方法，如果方法返回“success”则关闭
*		closefunc	点击关闭时调用的方法，如果方法返回“success”则关闭
*	windowWork 调用该方法所在的window
*	params 参数数组，传入回调函数中
*/
function calltopdailog2(data,windowWork,params){
	var jsonObject = eval("("+data+")");
	var src = jsonObject.src;
	var title = jsonObject.title;
	var position = "center";
	if(jsonObject.position){
		position = jsonObject.position;
	}
	var width=800;
	if(jsonObject.width){
		width = jsonObject.width;
	}
	var height=600;
	if(jsonObject.height){
		height = jsonObject.height;
	}
	var closefunc=jsonObject.closefunc;
	var savefunc=jsonObject.savefunc;
	$('<iframe scrolling="auto" frameborder="0" />').dialog({
               title: title,
               autoOpen: true,
               width: width,
               height: height,
               modal: true,
            position:position,
            open:function(){
                   $(this).attr("src",encodeURI(src));
            },
            buttons: {
				"确定": function() {
					if(savefunc){
						if(windowWork.eval(savefunc)(this,params)=="success"){
							$( this ).dialog( "close" );
						}
					}else{
						$( this ).dialog( "close" );
					}
				},
				"关闭": function() {
					if(closefunc){
						if(windowWork.eval(closefunc)(this,params)=="success"){
							$( this ).dialog( "close" );
						}
					}else{
						$( this ).dialog( "close" );
					}
				}
			}  
           }).width(width-30).height(height-30);
}
/**
*	弹出顶层窗口
*	data 为JSON串 其属性有：
*		src			弹出窗口链接
*		title		标题
*		width		弹出窗口的宽度
*		height		弹出窗口的高度
*		position	弹出位置
*		savefunc	点击保存时调用的方法，如果方法返回“success”则关闭
*		closefunc	点击关闭时调用的方法，如果方法返回“success”则关闭
*	windowWork 调用该方法所在的window
*	params 参数数组，传入回调函数中
*/
function calltopdailog3(data,windowWork,params){
	var jsonObject = eval("("+data+")");
	var src = jsonObject.src;
	var title = jsonObject.title;
	var position = "center";
	if(jsonObject.position){
		position = jsonObject.position;
	}
	var width=800;
	if(jsonObject.width){
		width = jsonObject.width;
	}
	var height=600;
	if(jsonObject.height){
		height = jsonObject.height;
	}
	var closefunc=jsonObject.closefunc;
	var savefunc=jsonObject.savefunc;
	$('<iframe scrolling="auto" frameborder="0"/>').dialog({
               title: title,
               autoOpen: true,
               width: width,
               height: height,
               modal: true,
            position:position,
            open:function(){
                   $(this).attr("src",encodeURI(src));
            },
            buttons: {
				"注册": function() {
					if(savefunc){
						if(windowWork.eval(savefunc)(this,params)=="success"){
							$( this ).dialog( "close" );
						}
					}else{
						$( this ).dialog( "close" );
					}
				},
				"关闭": function() {
					if(closefunc){
						if(windowWork.eval(closefunc)(this,params)=="success"){
							$( this ).dialog( "close" );
						}
					}else{
						$( this ).dialog( "close" );
					}
				}
			}  
           }).width(width-30).height(height-30);
}

/**
*	弹出顶层窗口
*	data 为JSON串 其属性有：
*		id			弹出窗口id
*		src			弹出窗口链接
*		title		标题
*		width		弹出窗口的宽度
*		height		弹出窗口的高度
*		position	弹出位置
*/
function calltopdailog1(data){
	var jsonObject = eval("("+data+")");
	var id = jsonObject.id;
	var src = jsonObject.src;
	var title = jsonObject.title;
	var position = "center";
	if(jsonObject.position){
		position = jsonObject.position;
	}
	var width=800;
	if(jsonObject.width){
		width = jsonObject.width;
	}
	var height=600;
	if(jsonObject.height){
		height = jsonObject.height;
	}
	if(document.getElementById(id)){
		$("#"+id).attr("src",encodeURI(src));
		$("#"+id).dialog({
               title: title,
               autoOpen: true,
               width: width,
               height: height,
               modal: true,
               resizable:false,
            position:position 
           }).width(width-30).height(height-30);
	}else{
		$('<iframe id="'+id+'" scrolling="auto" />').dialog({
               title: title,
               autoOpen: true,
               width: width,
               height: height,
               modal: true,
               resizable:false,
            open:function(){
                   $(this).attr("src",encodeURI(src));
            },
            position:position 
           }).width(width-30).height(height-30);
    }
}

function closedailog1(id){
	$("#"+id).dialog("destroy");
}